package com.hualu.zks.httpclient;

import org.apache.http.HttpResponse;



/**
 * Callback passed to an {@link AsyncRequestExecutor} so that the
 * calling code can be notified when a request is complete or
 * has thrown an exception.
 * 
 */
public abstract class AsyncHTTPCallback {

    
    /**
     * Called when response is available or max retries exhausted. 
     * 
     * @param httpResponse may be null!
     */
    //成功0；失败-1；其它错误-2；
    public abstract int onComplete(HttpResponse httpResponse);
    
    /**
     * Called when a non-recoverable exception has occurred.
     * Timeout exceptions are considered recoverable and won't
     * trigger this call.
     * 
     * @param e
     */
    public void onError(Exception e) {
        e.printStackTrace();
    }
    
    /**
     * 未登录
     */
    public void onUnauthorized() {
    	
    }

    /**
     * 404
     */
    public void onHttpNotFound() {
    	
    }
    
}
